/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "stdafx.h"
#include "物理力.h"

#include "节点/插座/通用插座.h"
#include "节点/插座/C_单值矢量插座.h"
#include "节点/插座/C_粒子插座.h"

#include <粒子/粒子.h>




C_单方向物理力节点::C_单方向物理力节点(S_设备环境& ctx) : C_节点基类("单方向物理力节点") {
	m_Name = L"单方向物理力节点";
	C_插座基类* socket;

	DEF_创建引用插座_I(L"物理体");
	DEF_创建Vec3插座_v1_I(L"力方向");


	vec3 g = {0.0f, -9.8f, 0.0f};
	f_get输入插座(2)->f_setData(&g);
}

bool C_单方向物理力节点::f_update() {
	auto& body = *DEF_引用插座数据(f_get输入插座(1), 0);
	auto f =  DEF_Vec3插座数据(f_get输入插座(2));

	switch (body.m_Type) {
		case E_值类型::e_Type_ParticleSystem:
			f_particle_set粒子单方向力(((S_粒子插座数据*)(body.m_Data))->m_Psy, f);
		break;
	default:
			break;
	}
	return false;
}

C_节点基类* f_node_加载单方向物理力节点(S_设备环境& ctx, FILE* f) {
	C_单方向物理力节点* node = new C_单方向物理力节点(ctx);
	return node;
}









